package cn.ljy.quicksnip.model;

import cn.ljy.common.model.BaseModel;
import cn.ljy.common.model.validate.AddWorkValidation;
import cn.ljy.common.model.validate.UpdateWorkValidation;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@ApiModel(value = "理发项目")
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false, of = {"id"})
public class QsProject extends BaseModel {

    @ApiModelProperty(value = "项目ID", example = "1")
    @NotNull(groups = UpdateWorkValidation.class, message = "项目ID不能为空")
    private Long id;

    @ApiModelProperty(value = "理发项目名称", required = true, example = "快剪")
    @NotBlank(groups = AddWorkValidation.class, message = "理发项目名称不能为空")
    @Size(min = 1, max = 30, message = "理发项目名称长度必须在 {min} - {max} 之间")
    private String name;

    @ApiModelProperty(value = "项目价格", required = true, example = "30.00")
    @NotNull(groups = AddWorkValidation.class, message = "项目价格不能为空")
    @DecimalMin(value = "0.00", inclusive = true, message = "项目价格不能小于0")
    @Digits(integer = 10, fraction = 2, message = "项目价格最多10位整数、2位小数")
    private BigDecimal price;

    public QsProject(Long id) {
        this.id = id;
    }
}
